<div class="container">

        <h1 id="pkg-overview">package types</h1>

        <p><code>import "go/types"</code>

        </p><p>
Package types declares the data types and implements
the algorithms for type-checking of Go packages. Use
Config.Check to invoke the type checker for a package.
Alternatively, create a new type checker with NewChecker
and invoke it incrementally by calling Checker.Files.
</p>
<p>
Type-checking consists of several interdependent phases:
</p>
<p>
Name resolution maps each identifier (ast.Ident) in the program to the
language object (Object) it denotes.
Use Info.{Defs,Uses,Implicits} for the results of name resolution.
</p>
<p>
Constant folding computes the exact constant value (constant.Value)
for every expression (ast.Expr) that is a compile-time constant.
Use Info.Types[expr].Value for the results of constant folding.
</p>
<p>
Type inference computes the type (Type) of every expression (ast.Expr)
and checks for compliance with the language specification.
Use Info.Types[expr].Type for the results of type inference.
</p>
<p>
For a tutorial, see <a href="https://github.com/golang/go/blob/master/s/types-tutorial">https://github.com/golang/go/blob/master/s/types-tutorial</a>.</p>


        
  


        
        

        

        

        
        
          
          
        

        
        


<p><a href="https://github.com/golang/go/blob/master/src/go/types/api.go">api.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/assignments.go">assignments.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/builtins.go">builtins.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/call.go">call.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/check.go">check.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/conversions.go">conversions.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/decl.go">decl.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/errors.go">errors.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/eval.go">eval.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/expr.go">expr.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/exprstring.go">exprstring.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/initorder.go">initorder.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/labels.go">labels.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/lookup.go">lookup.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/methodset.go">methodset.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/object.go">object.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/objset.go">objset.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/operand.go">operand.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/ordering.go">ordering.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/package.go">package.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/predicates.go">predicates.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/resolver.go">resolver.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/return.go">return.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/scope.go">scope.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/selection.go">selection.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/sizes.go">sizes.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/stmt.go">stmt.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/type.go">type.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/typestring.go">typestring.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/typexpr.go">typexpr.go</a> <a href="https://github.com/golang/go/blob/master/src/go/types/universe.go">universe.go</a> </p>

        
        

        
        
          <h2 id="pkg-variables">Variables </h2>
          
        

        
        
        
          <h2 data-kind="f" id="AssertableTo">func <a href="https://github.com/golang/go/blob/master/src/go/types/api.go#L353" title="View Source">AssertableTo</a>  </h2>
          <p>
AssertableTo reports whether a value of type V can be asserted to have type T.
</p>

          
  

        
          <h2 data-kind="f" id="AssignableTo">func <a href="https://github.com/golang/go/blob/master/src/go/types/api.go#L359" title="View Source">AssignableTo</a>  </h2>
          <p>
AssignableTo reports whether a value of type V is assignable to a variable of type T.
</p>

          
  

        
          <h2 data-kind="f" id="Comparable">func <a href="https://github.com/golang/go/blob/master/src/go/types/predicates.go#L81" title="View Source">Comparable</a>  </h2>
          <p>
Comparable reports whether values of type T are comparable.
</p>

          
  

        
          <h2 data-kind="f" id="ConvertibleTo">func <a href="https://github.com/golang/go/blob/master/src/go/types/api.go#L365" title="View Source">ConvertibleTo</a>  </h2>
          <p>
ConvertibleTo reports whether a value of type V is convertible to a value of type T.
</p>

          
  

        
          <h2 data-kind="f" id="DefPredeclaredTestFuncs">func <a href="https://github.com/golang/go/blob/master/src/go/types/universe.go#L170" title="View Source">DefPredeclaredTestFuncs</a>  </h2>
          <p>
DefPredeclaredTestFuncs defines the assert and trace built-ins.
These built-ins are intended for debugging and testing of this
package only.
</p>

          
  

        
          <h2 data-kind="f" id="ExprString">func <a href="https://github.com/golang/go/blob/master/src/go/types/exprstring.go#L15" title="View Source">ExprString</a>  </h2>
          <p>
ExprString returns the (possibly simplified) string representation for x.
</p>

          
  

        
          <h2 data-kind="f" id="Id">func <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L57" title="View Source">Id</a>  </h2>
          <p>
Id returns name if it is exported, otherwise it
returns the name qualified with the package <a href="/path">path</a>.
</p>

          
  

        
          <h2 data-kind="f" id="Identical">func <a href="https://github.com/golang/go/blob/master/src/go/types/predicates.go#L114" title="View Source">Identical</a>  </h2>
          <p>
Identical reports whether x and y are identical.
</p>

          
  

        
          <h2 data-kind="f" id="IdenticalIgnoreTags">func <a href="https://github.com/golang/go/blob/master/src/go/types/predicates.go#L119" title="View Source">IdenticalIgnoreTags</a>  </h2>
          <p>
IdenticalIgnoreTags reports whether x and y are identical if tags are ignored.
</p>

          
  

        
          <h2 data-kind="f" id="Implements">func <a href="https://github.com/golang/go/blob/master/src/go/types/api.go#L371" title="View Source">Implements</a>  </h2>
          <p>
Implements reports whether type V implements interface T.
</p>

          
  

        
          <h2 data-kind="f" id="IsInterface">func <a href="https://github.com/golang/go/blob/master/src/go/types/predicates.go#L75" title="View Source">IsInterface</a>  </h2>
          <p>
IsInterface reports whether typ is an interface type.
</p>

          
  

        
          <h2 data-kind="f" id="ObjectString">func <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L350" title="View Source">ObjectString</a>  </h2>
          <p>
ObjectString returns the string form of obj.
The Qualifier controls the printing of
package-level objects, and may be nil.
</p>

          
  

        
          <h2 data-kind="f" id="SelectionString">func <a href="https://github.com/golang/go/blob/master/src/go/types/selection.go#L119" title="View Source">SelectionString</a>  </h2>
          <p>
SelectionString returns the string form of s.
The Qualifier controls the printing of
package-level objects, and may be nil.
</p>
<p>
Examples:
</p>
<pre>"field (T) f int"
"method (T) f(X) Y"
"method expr (T) f(X) Y"
</pre>

          
  

        
          <h2 data-kind="f" id="TypeString">func <a href="https://github.com/golang/go/blob/master/src/go/types/typestring.go#L64" title="View Source">TypeString</a>  </h2>
          <p>
TypeString returns the string representation of typ.
The Qualifier controls the printing of
package-level objects, and may be nil.
</p>

          
  

        
          <h2 data-kind="f" id="WriteExpr">func <a href="https://github.com/golang/go/blob/master/src/go/types/exprstring.go#L22" title="View Source">WriteExpr</a>  </h2>
          <p>
WriteExpr writes the (possibly simplified) string representation for x to buf.
</p>

          
  

        
          <h2 data-kind="f" id="WriteSignature">func <a href="https://github.com/golang/go/blob/master/src/go/types/typestring.go#L274" title="View Source">WriteSignature</a>  </h2>
          <p>
WriteSignature writes the representation of the signature sig to buf,
without a leading "func" keyword.
The Qualifier controls the printing of
package-level objects, and may be nil.
</p>

          
  

        
          <h2 data-kind="f" id="WriteType">func <a href="https://github.com/golang/go/blob/master/src/go/types/typestring.go#L73" title="View Source">WriteType</a>  </h2>
          <p>
WriteType writes the string representation of typ to buf.
The Qualifier controls the printing of
package-level objects, and may be nil.
</p>

          
  

        

        
        

        
          <h2 data-kind="t" id="Array">type <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L94" title="View Source">Array</a>  </h2>
          <p>
An Array represents an array type.
</p>

          
          
          
  


          
            <h3 data-kind="f" id="NewArray">func <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L100" title="View Source">NewArray</a>  </h3>
            <p>
NewArray returns a new array type for the given element type and length.
</p>

            
  

          

          
            <h3 data-kind="m" id="Array.Elem">func (*Array) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L106" title="View Source">Elem</a>  </h3>
            <p>
Elem returns element type of array a.
</p>

            
  

          
            <h3 data-kind="m" id="Array.Len">func (*Array) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L103" title="View Source">Len</a>  </h3>
            <p>
Len returns the length of array a.
</p>

            
  

          
            <h3 data-kind="m" id="Array.String">func (*Array) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L441" title="View Source">String</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Array.Underlying">func (*Array) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L429" title="View Source">Underlying</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="Basic">type <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L78" title="View Source">Basic</a>  </h2>
          <p>
A Basic represents a basic type.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="Basic.Info">func (*Basic) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L88" title="View Source">Info</a>  </h3>
            <p>
Info returns information about properties of basic type b.
</p>

            
  

          
            <h3 data-kind="m" id="Basic.Kind">func (*Basic) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L85" title="View Source">Kind</a>  </h3>
            <p>
Kind returns the kind of basic type b.
</p>

            
  

          
            <h3 data-kind="m" id="Basic.Name">func (*Basic) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L91" title="View Source">Name</a>  </h3>
            <p>
Name returns the name of basic type b.
</p>

            
  

          
            <h3 data-kind="m" id="Basic.String">func (*Basic) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L440" title="View Source">String</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Basic.Underlying">func (*Basic) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L428" title="View Source">Underlying</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="BasicInfo">type <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L60" title="View Source">BasicInfo</a>  </h2>
          <p>
BasicInfo is a set of flags describing properties of a basic type.
</p>

          <p>
Properties of basic types.
</p>

          
          
  


          

          
        
          <h2 data-kind="t" id="BasicKind">type <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L20" title="View Source">BasicKind</a>  </h2>
          <p>
BasicKind describes the kind of basic type.
</p>

          
          
          
  


          

          
        
          <h2 data-kind="t" id="Builtin">type <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L252" title="View Source">Builtin</a>  </h2>
          <p>
A Builtin represents a built-in function.
Builtins don't have a valid type.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="Builtin.Exported">func (*Builtin) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L96" title="View Source">Exported</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Builtin.Id">func (*Builtin) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L97" title="View Source">Id</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Builtin.Name">func (*Builtin) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L94" title="View Source">Name</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Builtin.Parent">func (*Builtin) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L91" title="View Source">Parent</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Builtin.Pkg">func (*Builtin) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L93" title="View Source">Pkg</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Builtin.Pos">func (*Builtin) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L92" title="View Source">Pos</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Builtin.String">func (*Builtin) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L363" title="View Source">String</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Builtin.Type">func (*Builtin) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L95" title="View Source">Type</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="Chan">type <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L351" title="View Source">Chan</a>  </h2>
          <p>
A Chan represents a channel type.
</p>

          
          
          
  


          
            <h3 data-kind="f" id="NewChan">func <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L367" title="View Source">NewChan</a>  </h3>
            <p>
NewChan returns a new channel type for the given direction and element type.
</p>

            
  

          

          
            <h3 data-kind="m" id="Chan.Dir">func (*Chan) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L372" title="View Source">Dir</a>  </h3>
            <p>
Dir returns the direction of channel c.
</p>

            
  

          
            <h3 data-kind="m" id="Chan.Elem">func (*Chan) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L375" title="View Source">Elem</a>  </h3>
            <p>
Elem returns the element type of channel c.
</p>

            
  

          
            <h3 data-kind="m" id="Chan.String">func (*Chan) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L449" title="View Source">String</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Chan.Underlying">func (*Chan) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L437" title="View Source">Underlying</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="ChanDir">type <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L357" title="View Source">ChanDir</a>  </h2>
          <p>
A ChanDir value indicates a channel direction.
</p>

          <p>
The direction of a channel is indicated by one of these constants.
</p>

          
          
  


          

          
        
          <h2 data-kind="t" id="Checker">type <a href="https://github.com/golang/go/blob/master/src/go/types/check.go#L62" title="View Source">Checker</a>  </h2>
          <p>
A Checker maintains the state of the type checker.
It must be created with NewChecker.
</p>

          
          
          
  


          
            <h3 data-kind="f" id="NewChecker">func <a href="https://github.com/golang/go/blob/master/src/go/types/check.go#L148" title="View Source">NewChecker</a>  </h3>
            <p>
NewChecker returns a new Checker instance for a given package.
Package files may be added incrementally via checker.Files.
</p>

            
  

          

          
            <h3 data-kind="m" id="Checker.Files">func (*Checker) <a href="https://github.com/golang/go/blob/master/src/go/types/check.go#L218" title="View Source">Files</a>  </h3>
            <p>
Files checks the provided files as part of the checker's package.
</p>

            
  

          
        
          <h2 data-kind="t" id="Config">type <a href="https://github.com/golang/go/blob/master/src/go/types/api.go#L92" title="View Source">Config</a>  </h2>
          <p>
A Config specifies the configuration for type checking.
The zero value for Config is a ready-to-use default configuration.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="Config.Check">func (*Config) <a href="https://github.com/golang/go/blob/master/src/go/types/api.go#L347" title="View Source">Check</a>  </h3>
            <p>
Check type-checks a package and returns the resulting package object and
the first error if any. Additionally, if info != nil, Check populates each
of the non-nil maps in the Info struct.
</p>
<p>
The package is marked as complete if no errors occurred, otherwise it is
incomplete. See Config.Error for controlling behavior in the presence of
errors.
</p>
<p>
The package is specified by a list of *ast.Files and corresponding
file set, and the package <a href="/path">path</a> the package is identified with.
The clean path must not be empty or dot (".").
</p>

            
  

          
        
          <h2 data-kind="t" id="Const">type <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L144" title="View Source">Const</a>  </h2>
          <p>
A Const represents a declared constant.
</p>

          
          
          
  


          
            <h3 data-kind="f" id="NewConst">func <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L150" title="View Source">NewConst</a>  </h3>
            
            
  

          

          
            <h3 data-kind="m" id="Const.Exported">func (*Const) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L96" title="View Source">Exported</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Const.Id">func (*Const) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L97" title="View Source">Id</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Const.Name">func (*Const) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L94" title="View Source">Name</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Const.Parent">func (*Const) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L91" title="View Source">Parent</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Const.Pkg">func (*Const) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L93" title="View Source">Pkg</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Const.Pos">func (*Const) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L92" title="View Source">Pos</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Const.String">func (*Const) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L357" title="View Source">String</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Const.Type">func (*Const) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L95" title="View Source">Type</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Const.Val">func (*Const) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L154" title="View Source">Val</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="Error">type <a href="https://github.com/golang/go/blob/master/src/go/types/api.go#L41" title="View Source">Error</a>  </h2>
          <p>
An Error describes a type-checking error; it implements the error interface.
A "soft" error is an error that still permits a valid interpretation of a
package (such as "unused variable"); "hard" errors may lead to unpredictable
behavior if ignored.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="Error.Error">func (Error) <a href="https://github.com/golang/go/blob/master/src/go/types/api.go#L50" title="View Source">Error</a>  </h3>
            <p>
Error returns an error string formatted as follows:
filename:line:column: message
</p>

            
  

          
        
          <h2 data-kind="t" id="Func">type <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L194" title="View Source">Func</a>  </h2>
          <p>
A Func represents a declared function, concrete method, or abstract
(interface) method. Its Type() is always a *Signature.
An abstract method may belong to many interfaces due to embedding.
</p>

          
          
          
  


          
            <h3 data-kind="f" id="MissingMethod">func <a href="https://github.com/golang/go/blob/master/src/go/types/lookup.go#L237" title="View Source">MissingMethod</a>  </h3>
            <p>
MissingMethod returns (nil, false) if V implements T, otherwise it
returns a missing method required by T and whether it is missing or
just has the wrong type.
</p>
<p>
For non-interface types V, or if static is set, V implements T if all
methods of T are present in V. Otherwise (V is an interface and static
is not set), MissingMethod only checks that methods of T which are also
present in V have matching types (e.g., for a type assertion x.(T) where
x is of interface type V).
</p>

            
  

          
            <h3 data-kind="f" id="NewFunc">func <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L198" title="View Source">NewFunc</a>  </h3>
            
            
  

          

          
            <h3 data-kind="m" id="Func.Exported">func (*Func) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L96" title="View Source">Exported</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Func.FullName">func (*Func) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L209" title="View Source">FullName</a>  </h3>
            <p>
FullName returns the package- or receiver-type-qualified name of
function or method obj.
</p>

            
  

          
            <h3 data-kind="m" id="Func.Id">func (*Func) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L97" title="View Source">Id</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Func.Name">func (*Func) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L94" title="View Source">Name</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Func.Parent">func (*Func) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L91" title="View Source">Parent</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Func.Pkg">func (*Func) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L93" title="View Source">Pkg</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Func.Pos">func (*Func) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L92" title="View Source">Pos</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Func.Scope">func (*Func) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L215" title="View Source">Scope</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Func.String">func (*Func) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L360" title="View Source">String</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Func.Type">func (*Func) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L95" title="View Source">Type</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="ImportMode">type <a href="https://github.com/golang/go/blob/master/src/go/types/api.go#L68" title="View Source">ImportMode</a>  </h2>
          <p>
ImportMode is reserved for future use.
</p>

          
          
          
  


          

          
        
          <h2 data-kind="t" id="Importer">type <a href="https://github.com/golang/go/blob/master/src/go/types/api.go#L59" title="View Source">Importer</a>  </h2>
          <p>
An Importer resolves import paths to Packages.
</p>
<p>
CAUTION: This interface does not support the import of locally
vendored packages. See <a href="https://github.com/golang/go/blob/master/s/go15vendor">https://github.com/golang/go/blob/master/s/go15vendor</a>.
If possible, external implementations should implement ImporterFrom.
</p>

          
          
          
  


          

          
        
          <h2 data-kind="t" id="ImporterFrom">type <a href="https://github.com/golang/go/blob/master/src/go/types/api.go#L73" title="View Source">ImporterFrom</a>  </h2>
          <p>
An ImporterFrom resolves import paths to packages; it
supports vendoring per <a href="https://github.com/golang/go/blob/master/s/go15vendor">https://github.com/golang/go/blob/master/s/go15vendor</a>.
Use go/importer to obtain an ImporterFrom implementation.
</p>

          
          
          
  


          

          
        
          <h2 data-kind="t" id="Info">type <a href="https://github.com/golang/go/blob/master/src/go/types/api.go#L136" title="View Source">Info</a>  </h2>
          <p>
Info holds result type information for a type-checked package.
Only the information for which a map is provided is collected.
If the package has type errors, the collected information may
be incomplete.
</p>

          
          
          
  
    <div class="panel-group">
    
      <div class="panel panel-default" id="example-Info">
        <div class="panel-heading"><a class="accordion-toggle" data-toggle="collapse" href="#ex-Info">Example</a></div>
        <div class="panel-collapse collapse" id="ex-Info"><div class="panel-body">
          <p></p><p>
ExampleInfo prints various facts recorded by the type checker in a
types.Info struct: definitions of and references to each named object,
and the type, value, and mode of every expression in the package.
</p>

          <p>Code:
          </p><pre><span class="com">// Parse a single source file.</span>
const input = `
package fib

type S string

var a, b, c = len(b), S(c), "hello"

func fib(x int) int {
	if x &lt; 2 {
		return x
	}
	return fib(x-1) - fib(x-2)
}`
fset := token.NewFileSet()
f, err := parser.ParseFile(fset, "fib.go", input, 0)
if err != nil {
    log.Fatal(err)
}

<span class="com">// Type-check the package.
// We create an empty map for each kind of input
// we're interested in, and Check populates them.</span>
info := types.Info{
    Types: make(map[ast.Expr]types.TypeAndValue),
    Defs:  make(map[*ast.Ident]types.Object),
    Uses:  make(map[*ast.Ident]types.Object),
}
var conf types.Config
pkg, err := conf.Check("fib", fset, []*ast.File{f}, &amp;info)
if err != nil {
    log.Fatal(err)
}

<span class="com">// Print package-level variables in initialization order.</span>
fmt.Printf("InitOrder: %v\n\n", info.InitOrder)

<span class="com">// For each named object, print the line and
// column of its definition and each of its uses.</span>
fmt.Println("Defs and Uses of each named object:")
usesByObj := make(map[types.Object][]string)
for id, obj := range info.Uses {
    posn := fset.Position(id.Pos())
    lineCol := fmt.Sprintf("%d:%d", posn.Line, posn.Column)
    usesByObj[obj] = append(usesByObj[obj], lineCol)
}
var items []string
for obj, uses := range usesByObj {
    sort.Strings(uses)
    item := fmt.Sprintf("%s:\n  defined at %s\n  used at %s",
        types.ObjectString(obj, types.RelativeTo(pkg)),
        fset.Position(obj.Pos()),
        strings.Join(uses, ", "))
    items = append(items, item)
}
sort.Strings(items) <span class="com">// sort by line:col, in effect</span>
fmt.Println(strings.Join(items, "\n"))
fmt.Println()

fmt.Println("Types and Values of each expression:")
items = nil
for expr, tv := range info.Types {
    var buf bytes.Buffer
    posn := fset.Position(expr.Pos())
    tvstr := tv.Type.String()
    if tv.Value != nil {
        tvstr += " = " + tv.Value.String()
    }
    <span class="com">// line:col | expr | mode : type = value</span>
    fmt.Fprintf(&amp;buf, "%2d:%2d | %-19s | %-7s : %s",
        posn.Line, posn.Column, exprString(fset, expr),
        mode(tv), tvstr)
    items = append(items, buf.String())
}
sort.Strings(items)
fmt.Println(strings.Join(items, "\n"))</pre>
          <p>Output:</p><pre>InitOrder: [c = "hello" b = S(c) a = len(b)]

Defs and Uses of each named object:
builtin len:
  defined at -
  used at 6:15
func fib(x int) int:
  defined at fib.go:8:6
  used at 12:20, 12:9
type S string:
  defined at fib.go:4:6
  used at 6:23
type int int:
  defined at -
  used at 8:12, 8:17
type string string:
  defined at -
  used at 4:8
var b S:
  defined at fib.go:6:8
  used at 6:19
var c string:
  defined at fib.go:6:11
  used at 6:25
var x int:
  defined at fib.go:8:10
  used at 10:10, 12:13, 12:24, 9:5

Types and Values of each expression:
 4: 8 | string              | type    : string
 6:15 | len                 | builtin : func(string) int
 6:15 | len(b)              | value   : int
 6:19 | b                   | var     : fib.S
 6:23 | S                   | type    : fib.S
 6:23 | S(c)                | value   : fib.S
 6:25 | c                   | var     : string
 6:29 | "hello"             | value   : string = "hello"
 8:12 | int                 | type    : int
 8:17 | int                 | type    : int
 9: 5 | x                   | var     : int
 9: 5 | x &lt; 2               | value   : untyped bool
 9: 9 | 2                   | value   : int = 2
10:10 | x                   | var     : int
12: 9 | fib                 | value   : func(x int) int
12: 9 | fib(x - 1)          | value   : int
12: 9 | fib(x-1) - fib(x-2) | value   : int
12:13 | x                   | var     : int
12:13 | x - 1               | value   : int
12:15 | 1                   | value   : int = 1
12:20 | fib                 | value   : func(x int) int
12:20 | fib(x - 2)          | value   : int
12:24 | x                   | var     : int
12:24 | x - 2               | value   : int
12:26 | 2                   | value   : int = 2
</pre>
        </div></div>
      </div>
    
    </div>
  


          

          
            <h3 data-kind="m" id="Info.ObjectOf">func (*Info) <a href="https://github.com/golang/go/blob/master/src/go/types/api.go#L245" title="View Source">ObjectOf</a>  </h3>
            <p>
ObjectOf returns the object denoted by the specified id,
or nil if not found.
</p>
<p>
If id is an anonymous struct field, ObjectOf returns the field (*Var)
it uses, not the type (*TypeName) it defines.
</p>
<p>
Precondition: the Uses and Defs maps are populated.
</p>

            
  

          
            <h3 data-kind="m" id="Info.TypeOf">func (*Info) <a href="https://github.com/golang/go/blob/master/src/go/types/api.go#L225" title="View Source">TypeOf</a>  </h3>
            <p>
TypeOf returns the type of expression e, or nil if not found.
Precondition: the Types, Uses and Defs maps are populated.
</p>

            
  

          
        
          <h2 data-kind="t" id="Initializer">type <a href="https://github.com/golang/go/blob/master/src/go/types/api.go#L318" title="View Source">Initializer</a>  </h2>
          <p>
An Initializer describes a package-level variable, or a list of variables in case
of a multi-valued initialization expression, and the corresponding initialization
expression.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="Initializer.String">func (*Initializer) <a href="https://github.com/golang/go/blob/master/src/go/types/api.go#L323" title="View Source">String</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="Interface">type <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L241" title="View Source">Interface</a>  </h2>
          <p>
An Interface represents an interface type.
</p>

          
          
          
  


          
            <h3 data-kind="f" id="NewInterface">func <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L249" title="View Source">NewInterface</a>  </h3>
            <p>
NewInterface returns a new interface for the given methods and embedded types.
</p>

            
  

          

          
            <h3 data-kind="m" id="Interface.Complete">func (*Interface) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L301" title="View Source">Complete</a>  </h3>
            <p>
Complete computes the interface's method set. It must be called by users of
NewInterface after the interface's embedded types are fully defined and
before using the interface type in any way other than to form other types.
Complete returns the receiver.
</p>

            
  

          
            <h3 data-kind="m" id="Interface.Embedded">func (*Interface) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L285" title="View Source">Embedded</a>  </h3>
            <p>
Embedded returns the i'th embedded type of interface t for 0 &lt;= i &lt; t.NumEmbeddeds().
The types are ordered by the corresponding TypeName's unique Id.
</p>

            
  

          
            <h3 data-kind="m" id="Interface.Empty">func (*Interface) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L295" title="View Source">Empty</a>  </h3>
            <p>
Empty returns true if t is the empty interface.
</p>

            
  

          
            <h3 data-kind="m" id="Interface.ExplicitMethod">func (*Interface) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L278" title="View Source">ExplicitMethod</a>  </h3>
            <p>
ExplicitMethod returns the i'th explicitly declared method of interface t for 0 &lt;= i &lt; t.NumExplicitMethods().
The methods are ordered by their unique Id.
</p>

            
  

          
            <h3 data-kind="m" id="Interface.Method">func (*Interface) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L292" title="View Source">Method</a>  </h3>
            <p>
Method returns the i'th method of interface t for 0 &lt;= i &lt; t.NumMethods().
The methods are ordered by their unique Id.
</p>

            
  

          
            <h3 data-kind="m" id="Interface.NumEmbeddeds">func (*Interface) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L281" title="View Source">NumEmbeddeds</a>  </h3>
            <p>
NumEmbeddeds returns the number of embedded types in interface t.
</p>

            
  

          
            <h3 data-kind="m" id="Interface.NumExplicitMethods">func (*Interface) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L274" title="View Source">NumExplicitMethods</a>  </h3>
            <p>
NumExplicitMethods returns the number of explicitly declared methods of interface t.
</p>

            
  

          
            <h3 data-kind="m" id="Interface.NumMethods">func (*Interface) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L288" title="View Source">NumMethods</a>  </h3>
            <p>
NumMethods returns the total number of methods of interface t.
</p>

            
  

          
            <h3 data-kind="m" id="Interface.String">func (*Interface) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L447" title="View Source">String</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Interface.Underlying">func (*Interface) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L435" title="View Source">Underlying</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="Label">type <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L241" title="View Source">Label</a>  </h2>
          <p>
A Label represents a declared label.
</p>

          
          
          
  


          
            <h3 data-kind="f" id="NewLabel">func <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L246" title="View Source">NewLabel</a>  </h3>
            
            
  

          

          
            <h3 data-kind="m" id="Label.Exported">func (*Label) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L96" title="View Source">Exported</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Label.Id">func (*Label) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L97" title="View Source">Id</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Label.Name">func (*Label) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L94" title="View Source">Name</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Label.Parent">func (*Label) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L91" title="View Source">Parent</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Label.Pkg">func (*Label) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L93" title="View Source">Pkg</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Label.Pos">func (*Label) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L92" title="View Source">Pos</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Label.String">func (*Label) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L362" title="View Source">String</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Label.Type">func (*Label) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L95" title="View Source">Type</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="Map">type <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L335" title="View Source">Map</a>  </h2>
          <p>
A Map represents a map type.
</p>

          
          
          
  


          
            <h3 data-kind="f" id="NewMap">func <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L340" title="View Source">NewMap</a>  </h3>
            <p>
NewMap returns a new map for the given key and element types.
</p>

            
  

          

          
            <h3 data-kind="m" id="Map.Elem">func (*Map) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L348" title="View Source">Elem</a>  </h3>
            <p>
Elem returns the element type of map m.
</p>

            
  

          
            <h3 data-kind="m" id="Map.Key">func (*Map) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L345" title="View Source">Key</a>  </h3>
            <p>
Key returns the key type of map m.
</p>

            
  

          
            <h3 data-kind="m" id="Map.String">func (*Map) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L448" title="View Source">String</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Map.Underlying">func (*Map) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L436" title="View Source">Underlying</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="MethodSet">type <a href="https://github.com/golang/go/blob/master/src/go/types/methodset.go#L18" title="View Source">MethodSet</a>  </h2>
          <p>
A MethodSet is an ordered set of concrete or abstract (interface) methods;
a method is a MethodVal selection, and they are ordered by ascending m.Obj().Id().
The zero value for a MethodSet is a ready-to-use empty method set.
</p>

          
          
          
  
    <div class="panel-group">
    
      <div class="panel panel-default" id="example-MethodSet">
        <div class="panel-heading"><a class="accordion-toggle" data-toggle="collapse" href="#ex-MethodSet">Example</a></div>
        <div class="panel-collapse collapse" id="ex-MethodSet"><div class="panel-body">
          <p></p><p>
ExampleMethodSet prints the method sets of various types.
</p>

          <p>Code:<span class="pull-right"><a href="?play=MethodSet">play</a> </span>
          </p><pre><span class="com">// Parse a single source file.</span>
const input = `
package temperature
import "fmt"
type Celsius float64
func (c Celsius) String() string  { return fmt.Sprintf("%g°C", c) }
func (c *Celsius) SetF(f float64) { *c = Celsius(f - 32 / 9 * 5) }
`
fset := token.NewFileSet()
f, err := parser.ParseFile(fset, "celsius.go", input, 0)
if err != nil {
    log.Fatal(err)
}

<span class="com">// Type-check a package consisting of this file.
// Type information for the imported packages
// comes from $GOROOT/pkg/$GOOS_$GOOARCH/fmt.a.</span>
conf := types.Config{Importer: importer.Default()}
pkg, err := conf.Check("temperature", fset, []*ast.File{f}, nil)
if err != nil {
    log.Fatal(err)
}

<span class="com">// Print the method sets of Celsius and *Celsius.</span>
celsius := pkg.Scope().Lookup("Celsius").Type()
for _, t := range []types.Type{celsius, types.NewPointer(celsius)} {
    fmt.Printf("Method set of %s:\n", t)
    mset := types.NewMethodSet(t)
    for i := 0; i &lt; mset.Len(); i++ {
        fmt.Println(mset.At(i))
    }
    fmt.Println()
}</pre>
          <p>Output:</p><pre>Method set of temperature.Celsius:
method (temperature.Celsius) String() string

Method set of *temperature.Celsius:
method (*temperature.Celsius) SetF(f float64)
method (*temperature.Celsius) String() string
</pre>
        </div></div>
      </div>
    
    </div>
  


          
            <h3 data-kind="f" id="NewMethodSet">func <a href="https://github.com/golang/go/blob/master/src/go/types/methodset.go#L67" title="View Source">NewMethodSet</a>  </h3>
            <p>
NewMethodSet returns the method set for the given type T.
It always returns a non-nil method set, even if it is empty.
</p>

            
  

          

          
            <h3 data-kind="m" id="MethodSet.At">func (*MethodSet) <a href="https://github.com/golang/go/blob/master/src/go/types/methodset.go#L40" title="View Source">At</a>  </h3>
            <p>
At returns the i'th method in s for 0 &lt;= i &lt; s.Len().
</p>

            
  

          
            <h3 data-kind="m" id="MethodSet.Len">func (*MethodSet) <a href="https://github.com/golang/go/blob/master/src/go/types/methodset.go#L37" title="View Source">Len</a>  </h3>
            <p>
Len returns the number of methods in s.
</p>

            
  

          
            <h3 data-kind="m" id="MethodSet.Lookup">func (*MethodSet) <a href="https://github.com/golang/go/blob/master/src/go/types/methodset.go#L43" title="View Source">Lookup</a>  </h3>
            <p>
Lookup returns the method with matching package and name, or nil if not found.
</p>

            
  

          
            <h3 data-kind="m" id="MethodSet.String">func (*MethodSet) <a href="https://github.com/golang/go/blob/master/src/go/types/methodset.go#L22" title="View Source">String</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="Named">type <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L378" title="View Source">Named</a>  </h2>
          <p>
A Named represents a named type.
</p>

          
          
          
  


          
            <h3 data-kind="f" id="NewNamed">func <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L386" title="View Source">NewNamed</a>  </h3>
            <p>
NewNamed returns a new named type for the given type name, underlying type, and associated methods.
The underlying type must not be a *Named.
</p>

            
  

          

          
            <h3 data-kind="m" id="Named.AddMethod">func (*Named) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L420" title="View Source">AddMethod</a>  </h3>
            <p>
AddMethod adds method m unless it is already in the method list.
TODO(gri) find a better solution instead of providing this function
</p>

            
  

          
            <h3 data-kind="m" id="Named.Method">func (*Named) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L404" title="View Source">Method</a>  </h3>
            <p>
Method returns the i'th method of named type t for 0 &lt;= i &lt; t.NumMethods().
</p>

            
  

          
            <h3 data-kind="m" id="Named.NumMethods">func (*Named) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L401" title="View Source">NumMethods</a>  </h3>
            <p>
NumMethods returns the number of explicit methods whose receiver is named type t.
</p>

            
  

          
            <h3 data-kind="m" id="Named.Obj">func (*Named) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L398" title="View Source">Obj</a>  </h3>
            <p>
TypeName returns the type name for the named type t.
</p>

            
  

          
            <h3 data-kind="m" id="Named.SetUnderlying">func (*Named) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L408" title="View Source">SetUnderlying</a>  </h3>
            <p>
SetUnderlying sets the underlying type and marks t as complete.
TODO(gri) determine if there's a better solution rather than providing this function
</p>

            
  

          
            <h3 data-kind="m" id="Named.String">func (*Named) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L450" title="View Source">String</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Named.Underlying">func (*Named) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L438" title="View Source">Underlying</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="Nil">type <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L262" title="View Source">Nil</a>  </h2>
          <p>
Nil represents the predeclared value nil.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="Nil.Exported">func (*Nil) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L96" title="View Source">Exported</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Nil.Id">func (*Nil) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L97" title="View Source">Id</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Nil.Name">func (*Nil) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L94" title="View Source">Name</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Nil.Parent">func (*Nil) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L91" title="View Source">Parent</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Nil.Pkg">func (*Nil) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L93" title="View Source">Pkg</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Nil.Pos">func (*Nil) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L92" title="View Source">Pos</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Nil.String">func (*Nil) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L364" title="View Source">String</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Nil.Type">func (*Nil) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L95" title="View Source">Type</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="Object">type <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L21" title="View Source">Object</a>  </h2>
          <p>
An Object describes a named language entity such as a package,
constant, type, variable, function (incl. methods), or label.
All objects implement the Object interface.
</p>

          
          
          
  


          
            <h3 data-kind="f" id="LookupFieldOrMethod">func <a href="https://github.com/golang/go/blob/master/src/go/types/lookup.go#L35" title="View Source">LookupFieldOrMethod</a>  </h3>
            <p>
LookupFieldOrMethod looks up a field or method with given package and name
in T and returns the corresponding *Var or *Func, an index sequence, and a
bool indicating if there were any pointer indirections on the path to the
field or method. If addressable is set, T is the type of an addressable
variable (only matters for method lookups).
</p>
<p>
The last index entry is the field or method index in the (possibly embedded)
type where the entry was found, either:
</p>
<pre>1) the list of declared methods of a named type; or
2) the list of all methods (method set) of an interface type; or
3) the list of fields of a struct type.
</pre>
<p>
The earlier index entries are the indices of the anonymous struct fields
traversed to get to the found entry, starting at depth 0.
</p>
<p>
If no entry is found, a nil object is returned. In this case, the returned
index and indirect values have the following meaning:
</p>
<pre>	- If index != nil, the index sequence points to an ambiguous entry
	(the same name appeared more than once at the same embedding level).

	- If indirect is set, a method with a pointer receiver type was found
     but there was no pointer on the path from the actual receiver type to
	the method's formal receiver base type, nor was the receiver addressable.
</pre>

            
  

          

          
        
          <h2 data-kind="t" id="Package">type <a href="https://github.com/golang/go/blob/master/src/go/types/package.go#L13" title="View Source">Package</a>  </h2>
          <p>
A Package describes a Go package.
</p>

          
          
          
  


          
            <h3 data-kind="f" id="NewPackage">func <a href="https://github.com/golang/go/blob/master/src/go/types/package.go#L25" title="View Source">NewPackage</a>  </h3>
            <p>
NewPackage returns a new Package for the given package <a href="/path">path</a> and name;
the name must not be the blank identifier.
The package is not complete and contains no explicit imports.
</p>

            
  

          

          
            <h3 data-kind="m" id="Package.Complete">func (*Package) <a href="https://github.com/golang/go/blob/master/src/go/types/package.go#L49" title="View Source">Complete</a>  </h3>
            <p>
A package is complete if its scope contains (at least) all
exported objects; otherwise it is incomplete.
</p>

            
  

          
            <h3 data-kind="m" id="Package.Imports">func (*Package) <a href="https://github.com/golang/go/blob/master/src/go/types/package.go#L60" title="View Source">Imports</a>  </h3>
            <p>
Imports returns the list of packages directly imported by
pkg; the list is in source order. Package unsafe is excluded.
</p>
<p>
If pkg was loaded from export data, Imports includes packages that
provide package-level objects referenced by pkg. This may be more or
less than the set of packages directly imported by pkg's source code.
</p>

            
  

          
            <h3 data-kind="m" id="Package.MarkComplete">func (*Package) <a href="https://github.com/golang/go/blob/master/src/go/types/package.go#L52" title="View Source">MarkComplete</a>  </h3>
            <p>
MarkComplete marks a package as complete.
</p>

            
  

          
            <h3 data-kind="m" id="Package.Name">func (*Package) <a href="https://github.com/golang/go/blob/master/src/go/types/package.go#L37" title="View Source">Name</a>  </h3>
            <p>
Name returns the package name.
</p>

            
  

          
            <h3 data-kind="m" id="Package.Path">func (*Package) <a href="https://github.com/golang/go/blob/master/src/go/types/package.go#L34" title="View Source">Path</a>  </h3>
            <p>
Path returns the package <a href="/path">path</a>.
</p>

            
  

          
            <h3 data-kind="m" id="Package.Scope">func (*Package) <a href="https://github.com/golang/go/blob/master/src/go/types/package.go#L45" title="View Source">Scope</a>  </h3>
            <p>
Scope returns the (complete or incomplete) package scope
holding the objects declared at package level (TypeNames,
Consts, Vars, and Funcs).
</p>

            
  

          
            <h3 data-kind="m" id="Package.SetImports">func (*Package) <a href="https://github.com/golang/go/blob/master/src/go/types/package.go#L64" title="View Source">SetImports</a>  </h3>
            <p>
SetImports sets the list of explicitly imported packages to list.
It is the caller's responsibility to make sure list elements are unique.
</p>

            
  

          
            <h3 data-kind="m" id="Package.SetName">func (*Package) <a href="https://github.com/golang/go/blob/master/src/go/types/package.go#L40" title="View Source">SetName</a>  </h3>
            <p>
SetName sets the package name.
</p>

            
  

          
            <h3 data-kind="m" id="Package.String">func (*Package) <a href="https://github.com/golang/go/blob/master/src/go/types/package.go#L66" title="View Source">String</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="PkgName">type <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L129" title="View Source">PkgName</a>  </h2>
          <p>
A PkgName represents an imported Go package.
</p>

          
          
          
  


          
            <h3 data-kind="f" id="NewPkgName">func <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L135" title="View Source">NewPkgName</a>  </h3>
            
            
  

          

          
            <h3 data-kind="m" id="PkgName.Exported">func (*PkgName) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L96" title="View Source">Exported</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="PkgName.Id">func (*PkgName) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L97" title="View Source">Id</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="PkgName.Imported">func (*PkgName) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L141" title="View Source">Imported</a>  </h3>
            <p>
Imported returns the package that was imported.
It is distinct from Pkg(), which is the package containing the import statement.
</p>

            
  

          
            <h3 data-kind="m" id="PkgName.Name">func (*PkgName) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L94" title="View Source">Name</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="PkgName.Parent">func (*PkgName) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L91" title="View Source">Parent</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="PkgName.Pkg">func (*PkgName) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L93" title="View Source">Pkg</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="PkgName.Pos">func (*PkgName) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L92" title="View Source">Pos</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="PkgName.String">func (*PkgName) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L356" title="View Source">String</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="PkgName.Type">func (*PkgName) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L95" title="View Source">Type</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="Pointer">type <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L157" title="View Source">Pointer</a>  </h2>
          <p>
A Pointer represents a pointer type.
</p>

          
          
          
  


          
            <h3 data-kind="f" id="NewPointer">func <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L162" title="View Source">NewPointer</a>  </h3>
            <p>
NewPointer returns a new pointer type for the given element (base) type.
</p>

            
  

          

          
            <h3 data-kind="m" id="Pointer.Elem">func (*Pointer) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L165" title="View Source">Elem</a>  </h3>
            <p>
Elem returns the element type for the given pointer p.
</p>

            
  

          
            <h3 data-kind="m" id="Pointer.String">func (*Pointer) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L444" title="View Source">String</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Pointer.Underlying">func (*Pointer) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L432" title="View Source">Underlying</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="Qualifier">type <a href="https://github.com/golang/go/blob/master/src/go/types/typestring.go#L25" title="View Source">Qualifier</a>  </h2>
          <p>
A Qualifier controls how named package-level objects are printed in
calls to TypeString, ObjectString, and SelectionString.
</p>
<p>
These three formatting routines call the Qualifier for each
package-level object O, and if the Qualifier returns a non-empty
string p, the object is printed in the form p.O.
If it returns an empty string, only the object name O is printed.
</p>
<p>
Using a nil Qualifier is equivalent to using (*Package).Path: the
object is qualified by the import path, e.g., "encoding/json.Marshal".
</p>

          
          
          
  


          
            <h3 data-kind="f" id="RelativeTo">func <a href="https://github.com/golang/go/blob/master/src/go/types/typestring.go#L29" title="View Source">RelativeTo</a>  </h3>
            <p>
RelativeTo(pkg) returns a Qualifier that fully qualifies members of
all packages other than pkg.
</p>

            
  

          

          
        
          <h2 data-kind="t" id="Scope">type <a href="https://github.com/golang/go/blob/master/src/go/types/scope.go#L25" title="View Source">Scope</a>  </h2>
          <p>
A Scope maintains a set of objects and links to its containing
(parent) and contained (children) scopes. Objects may be inserted
and looked up by name. The zero value for Scope is a ready-to-use
empty scope.
</p>

          
          
          
  
    <div class="panel-group">
    
      <div class="panel panel-default" id="example-Scope">
        <div class="panel-heading"><a class="accordion-toggle" data-toggle="collapse" href="#ex-Scope">Example</a></div>
        <div class="panel-collapse collapse" id="ex-Scope"><div class="panel-body">
          <p></p><p>
ExampleScope prints the tree of Scopes of a package created from a
set of parsed files.
</p>

          <p>Code:<span class="pull-right"><a href="?play=Scope">play</a> </span>
          </p><pre><span class="com">// Parse the source files for a package.</span>
fset := token.NewFileSet()
var files []*ast.File
for _, file := range []struct{ name, input string }{
    {"main.go", `
package main
import "fmt"
func main() {
	freezing := FToC(-18)
	fmt.Println(freezing, Boiling) }
`},
    {"celsius.go", `
package main
import "fmt"
type Celsius float64
func (c Celsius) String() string { return fmt.Sprintf("%g°C", c) }
func FToC(f float64) Celsius { return Celsius(f - 32 / 9 * 5) }
const Boiling Celsius = 100
`},
} {
    f, err := parser.ParseFile(fset, file.name, file.input, 0)
    if err != nil {
        log.Fatal(err)
    }
    files = append(files, f)
}

<span class="com">// Type-check a package consisting of these files.
// Type information for the imported "fmt" package
// comes from $GOROOT/pkg/$GOOS_$GOOARCH/fmt.a.</span>
conf := types.Config{Importer: importer.Default()}
pkg, err := conf.Check("temperature", fset, files, nil)
if err != nil {
    log.Fatal(err)
}

<span class="com">// Print the tree of scopes.
// For determinism, we redact addresses.</span>
var buf bytes.Buffer
pkg.Scope().WriteTo(&amp;buf, 0, true)
rx := regexp.MustCompile(` 0x[a-fA-F0-9]*`)
fmt.Println(rx.ReplaceAllString(buf.String(), ""))</pre>
          <p>Output:</p><pre>package "temperature" scope {
.  const temperature.Boiling temperature.Celsius
.  type temperature.Celsius float64
.  func temperature.FToC(f float64) temperature.Celsius
.  func temperature.main()

.  main.go scope {
.  .  package fmt

.  .  function scope {
.  .  .  var freezing temperature.Celsius
.  .  }.  }
.  celsius.go scope {
.  .  package fmt

.  .  function scope {
.  .  .  var c temperature.Celsius
.  .  }
.  .  function scope {
.  .  .  var f float64
.  .  }.  }}
</pre>
        </div></div>
      </div>
    
    </div>
  


          
            <h3 data-kind="f" id="NewScope">func <a href="https://github.com/golang/go/blob/master/src/go/types/scope.go#L35" title="View Source">NewScope</a>  </h3>
            <p>
NewScope returns a new, empty scope contained in the given parent
scope, if any. The comment is for debugging only.
</p>

            
  

          

          
            <h3 data-kind="m" id="Scope.Child">func (*Scope) <a href="https://github.com/golang/go/blob/master/src/go/types/scope.go#L66" title="View Source">Child</a>  </h3>
            <p>
Child returns the i'th child scope for 0 &lt;= i &lt; NumChildren().
</p>

            
  

          
            <h3 data-kind="m" id="Scope.Contains">func (*Scope) <a href="https://github.com/golang/go/blob/master/src/go/types/scope.go#L123" title="View Source">Contains</a>  </h3>
            <p>
Contains returns true if pos is within the scope's extent.
The result is guaranteed to be valid only if the type-checked
AST has complete position information.
</p>

            
  

          
            <h3 data-kind="m" id="Scope.End">func (*Scope) <a href="https://github.com/golang/go/blob/master/src/go/types/scope.go#L118" title="View Source">End</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Scope.Innermost">func (*Scope) <a href="https://github.com/golang/go/blob/master/src/go/types/scope.go#L132" title="View Source">Innermost</a>  </h3>
            <p>
Innermost returns the innermost (child) scope containing
pos. If pos is not within any scope, the result is nil.
The result is also nil for the Universe scope.
The result is guaranteed to be valid only if the type-checked
AST has complete position information.
</p>

            
  

          
            <h3 data-kind="m" id="Scope.Insert">func (*Scope) <a href="https://github.com/golang/go/blob/master/src/go/types/scope.go#L98" title="View Source">Insert</a>  </h3>
            <p>
Insert attempts to insert an object obj into scope s.
If s already contains an alternative object alt with
the same name, Insert leaves s unchanged and returns alt.
Otherwise it inserts obj, sets the object's parent scope
if not already set, and returns nil.
</p>

            
  

          
            <h3 data-kind="m" id="Scope.Len">func (*Scope) <a href="https://github.com/golang/go/blob/master/src/go/types/scope.go#L48" title="View Source">Len</a>  </h3>
            <p>
Len() returns the number of scope elements.
</p>

            
  

          
            <h3 data-kind="m" id="Scope.Lookup">func (*Scope) <a href="https://github.com/golang/go/blob/master/src/go/types/scope.go#L70" title="View Source">Lookup</a>  </h3>
            <p>
Lookup returns the object in scope s with the given name if such an
object exists; otherwise the result is nil.
</p>

            
  

          
            <h3 data-kind="m" id="Scope.LookupParent">func (*Scope) <a href="https://github.com/golang/go/blob/master/src/go/types/scope.go#L84" title="View Source">LookupParent</a>  </h3>
            <p>
LookupParent follows the parent chain of scopes starting with s until
it finds a scope where Lookup(name) returns a non-nil object, and then
returns that scope and object. If a valid position pos is provided,
only objects that were declared at or before pos are considered.
If no such scope and object exists, the result is (nil, nil).
</p>
<p>
Note that obj.Parent() may be different from the returned scope if the
object was inserted into the scope and already had a parent at that
time (see Insert, below). This can only happen for dot-imported objects
whose scope is the scope of the package that exported them.
</p>

            
  

          
            <h3 data-kind="m" id="Scope.Names">func (*Scope) <a href="https://github.com/golang/go/blob/master/src/go/types/scope.go#L51" title="View Source">Names</a>  </h3>
            <p>
Names returns the scope's element names in sorted order.
</p>

            
  

          
            <h3 data-kind="m" id="Scope.NumChildren">func (*Scope) <a href="https://github.com/golang/go/blob/master/src/go/types/scope.go#L63" title="View Source">NumChildren</a>  </h3>
            <p>
NumChildren() returns the number of scopes nested in s.
</p>

            
  

          
            <h3 data-kind="m" id="Scope.Parent">func (*Scope) <a href="https://github.com/golang/go/blob/master/src/go/types/scope.go#L45" title="View Source">Parent</a>  </h3>
            <p>
Parent returns the scope's containing (parent) scope.
</p>

            
  

          
            <h3 data-kind="m" id="Scope.Pos">func (*Scope) <a href="https://github.com/golang/go/blob/master/src/go/types/scope.go#L117" title="View Source">Pos</a>  </h3>
            <p>
Pos and End describe the scope's source code extent [pos, end).
The results are guaranteed to be valid only if the type-checked
AST has complete position information. The extent is undefined
for Universe and package scopes.
</p>

            
  

          
            <h3 data-kind="m" id="Scope.String">func (*Scope) <a href="https://github.com/golang/go/blob/master/src/go/types/scope.go#L186" title="View Source">String</a>  </h3>
            <p>
String returns a string representation of the scope, for debugging.
</p>

            
  

          
            <h3 data-kind="m" id="Scope.WriteTo">func (*Scope) <a href="https://github.com/golang/go/blob/master/src/go/types/scope.go#L159" title="View Source">WriteTo</a>  </h3>
            <p>
WriteTo writes a string representation of the scope to w,
with the scope elements sorted by name.
The level of indentation is controlled by n &gt;= 0, with
n == 0 for no indentation.
If recurse is set, it also writes nested (children) scopes.
</p>

            
  

          
        
          <h2 data-kind="t" id="Selection">type <a href="https://github.com/golang/go/blob/master/src/go/types/selection.go#L40" title="View Source">Selection</a>  </h2>
          <p>
A Selection describes a selector expression x.f.
For the declarations:
</p>
<pre>type T struct{ x int; E }
type E struct{}
func (e E) m() {}
var p *T
</pre>
<p>
the following relations exist:
</p>
<pre>Selector    Kind          Recv    Obj    Type               Index     Indirect

p.x         FieldVal      T       x      int                {0}       true
p.m         MethodVal     *T      m      func (e *T) m()    {1, 0}    true
T.m         MethodExpr    T       m      func m(_ T)        {1, 0}    false
</pre>

          
          
          
  


          

          
            <h3 data-kind="m" id="Selection.Index">func (*Selection) <a href="https://github.com/golang/go/blob/master/src/go/types/selection.go#L102" title="View Source">Index</a>  </h3>
            <p>
Index describes the path from x to f in x.f.
The last index entry is the field or method index of the type declaring f;
either:
</p>
<pre>1) the list of declared methods of a named type; or
2) the list of methods of an interface type; or
3) the list of fields of a struct type.
</pre>
<p>
The earlier index entries are the indices of the embedded fields implicitly
traversed to get from (the type of) x to f, starting at embedding depth 0.
</p>

            
  

          
            <h3 data-kind="m" id="Selection.Indirect">func (*Selection) <a href="https://github.com/golang/go/blob/master/src/go/types/selection.go#L106" title="View Source">Indirect</a>  </h3>
            <p>
Indirect reports whether any pointer indirection was required to get from
x to f in x.f.
</p>

            
  

          
            <h3 data-kind="m" id="Selection.Kind">func (*Selection) <a href="https://github.com/golang/go/blob/master/src/go/types/selection.go#L49" title="View Source">Kind</a>  </h3>
            <p>
Kind returns the selection kind.
</p>

            
  

          
            <h3 data-kind="m" id="Selection.Obj">func (*Selection) <a href="https://github.com/golang/go/blob/master/src/go/types/selection.go#L56" title="View Source">Obj</a>  </h3>
            <p>
Obj returns the object denoted by x.f; a *Var for
a field selection, and a *Func in all other cases.
</p>

            
  

          
            <h3 data-kind="m" id="Selection.Recv">func (*Selection) <a href="https://github.com/golang/go/blob/master/src/go/types/selection.go#L52" title="View Source">Recv</a>  </h3>
            <p>
Recv returns the type of x in x.f.
</p>

            
  

          
            <h3 data-kind="m" id="Selection.String">func (*Selection) <a href="https://github.com/golang/go/blob/master/src/go/types/selection.go#L108" title="View Source">String</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Selection.Type">func (*Selection) <a href="https://github.com/golang/go/blob/master/src/go/types/selection.go#L60" title="View Source">Type</a>  </h3>
            <p>
Type returns the type of x.f, which may be different from the type of f.
See Selection for more information.
</p>

            
  

          
        
          <h2 data-kind="t" id="SelectionKind">type <a href="https://github.com/golang/go/blob/master/src/go/types/selection.go#L16" title="View Source">SelectionKind</a>  </h2>
          <p>
SelectionKind describes the kind of a selector expression x.f
(excluding qualified identifiers).
</p>

          
          
          
  


          

          
        
          <h2 data-kind="t" id="Signature">type <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L194" title="View Source">Signature</a>  </h2>
          <p>
A Signature represents a (non-builtin) function or method type.
</p>

          
          
          
  


          
            <h3 data-kind="f" id="NewSignature">func <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L210" title="View Source">NewSignature</a>  </h3>
            <p>
NewSignature returns a new function type for the given receiver, parameters,
and results, either of which may be nil. If variadic is set, the function
is variadic, it must have at least one parameter, and the last parameter
must be of unnamed slice type.
</p>

            
  

          

          
            <h3 data-kind="m" id="Signature.Params">func (*Signature) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L232" title="View Source">Params</a>  </h3>
            <p>
Params returns the parameters of signature s, or nil.
</p>

            
  

          
            <h3 data-kind="m" id="Signature.Recv">func (*Signature) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L229" title="View Source">Recv</a>  </h3>
            <p>
Recv returns the receiver of signature s (if a method), or nil if a
function.
</p>
<p>
For an abstract method, Recv returns the enclosing interface either
as a *Named or an *Interface. Due to embedding, an interface may
contain methods whose receiver type is a different interface.
</p>

            
  

          
            <h3 data-kind="m" id="Signature.Results">func (*Signature) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L235" title="View Source">Results</a>  </h3>
            <p>
Results returns the results of signature s, or nil.
</p>

            
  

          
            <h3 data-kind="m" id="Signature.String">func (*Signature) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L446" title="View Source">String</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Signature.Underlying">func (*Signature) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L434" title="View Source">Underlying</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Signature.Variadic">func (*Signature) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L238" title="View Source">Variadic</a>  </h3>
            <p>
Variadic reports whether the signature s is variadic.
</p>

            
  

          
        
          <h2 data-kind="t" id="Sizes">type <a href="https://github.com/golang/go/blob/master/src/go/types/sizes.go#L10" title="View Source">Sizes</a>  </h2>
          <p>
Sizes defines the sizing functions for package <a href="/unsafe">unsafe</a>.
</p>

          
          
          
  


          

          
        
          <h2 data-kind="t" id="Slice">type <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L109" title="View Source">Slice</a>  </h2>
          <p>
A Slice represents a slice type.
</p>

          
          
          
  


          
            <h3 data-kind="f" id="NewSlice">func <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L114" title="View Source">NewSlice</a>  </h3>
            <p>
NewSlice returns a new slice type for the given element type.
</p>

            
  

          

          
            <h3 data-kind="m" id="Slice.Elem">func (*Slice) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L117" title="View Source">Elem</a>  </h3>
            <p>
Elem returns the element type of slice s.
</p>

            
  

          
            <h3 data-kind="m" id="Slice.String">func (*Slice) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L442" title="View Source">String</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Slice.Underlying">func (*Slice) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L430" title="View Source">Underlying</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="StdSizes">type <a href="https://github.com/golang/go/blob/master/src/go/types/sizes.go#L43" title="View Source">StdSizes</a>  </h2>
          <p>
StdSizes is a convenience type for creating commonly used Sizes.
It makes the following simplifying assumptions:
</p>
<pre>	- The size of explicitly sized basic types (int16, etc.) is the
	  specified size.
	- The size of strings and interfaces is 2*WordSize.
	- The size of slices is 3*WordSize.
	- The size of an array of n elements corresponds to the size of
	  a struct of n consecutive fields of the array's element type.
     - The size of a struct is the offset of the last field plus that
	  field's size. As with all element types, if the struct is used
	  in an array its size must first be aligned to a multiple of the
	  struct's alignment.
	- All other types have size WordSize.
	- Arrays and structs are aligned per spec definition; all other
	  types are naturally aligned with a maximum alignment MaxAlign.
</pre>
<p>
*StdSizes implements Sizes.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="StdSizes.Alignof">func (*StdSizes) <a href="https://github.com/golang/go/blob/master/src/go/types/sizes.go#L48" title="View Source">Alignof</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="StdSizes.Offsetsof">func (*StdSizes) <a href="https://github.com/golang/go/blob/master/src/go/types/sizes.go#L92" title="View Source">Offsetsof</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="StdSizes.Sizeof">func (*StdSizes) <a href="https://github.com/golang/go/blob/master/src/go/types/sizes.go#L120" title="View Source">Sizeof</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="Struct">type <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L120" title="View Source">Struct</a>  </h2>
          <p>
A Struct represents a struct type.
</p>

          
          
          
  


          
            <h3 data-kind="f" id="NewStruct">func <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L129" title="View Source">NewStruct</a>  </h3>
            <p>
NewStruct returns a new struct with the given fields and corresponding field tags.
If a field with index i has a tag, tags[i] must be that tag, but len(tags) may be
only as long as required to hold the tag with the largest index i. Consequently,
if no field has a tag, tags may be nil.
</p>

            
  

          

          
            <h3 data-kind="m" id="Struct.Field">func (*Struct) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L146" title="View Source">Field</a>  </h3>
            <p>
Field returns the i'th field for 0 &lt;= i &lt; NumFields().
</p>

            
  

          
            <h3 data-kind="m" id="Struct.NumFields">func (*Struct) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L143" title="View Source">NumFields</a>  </h3>
            <p>
NumFields returns the number of fields in the struct (including blank and anonymous fields).
</p>

            
  

          
            <h3 data-kind="m" id="Struct.String">func (*Struct) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L443" title="View Source">String</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Struct.Tag">func (*Struct) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L149" title="View Source">Tag</a>  </h3>
            <p>
Tag returns the i'th field tag for 0 &lt;= i &lt; NumFields().
</p>

            
  

          
            <h3 data-kind="m" id="Struct.Underlying">func (*Struct) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L431" title="View Source">Underlying</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="Tuple">type <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L170" title="View Source">Tuple</a>  </h2>
          <p>
A Tuple represents an ordered list of variables; a nil *Tuple is a valid (empty) tuple.
Tuples are used as components of signatures and to represent the type of multiple
assignments; they are not first class types of Go.
</p>

          
          
          
  


          
            <h3 data-kind="f" id="NewTuple">func <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L175" title="View Source">NewTuple</a>  </h3>
            <p>
NewTuple returns a new tuple for the given variables.
</p>

            
  

          

          
            <h3 data-kind="m" id="Tuple.At">func (*Tuple) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L191" title="View Source">At</a>  </h3>
            <p>
At returns the i'th variable of tuple t.
</p>

            
  

          
            <h3 data-kind="m" id="Tuple.Len">func (*Tuple) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L183" title="View Source">Len</a>  </h3>
            <p>
Len returns the number variables of tuple t.
</p>

            
  

          
            <h3 data-kind="m" id="Tuple.String">func (*Tuple) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L445" title="View Source">String</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Tuple.Underlying">func (*Tuple) <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L433" title="View Source">Underlying</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="Type">type <a href="https://github.com/golang/go/blob/master/src/go/types/type.go#L11" title="View Source">Type</a>  </h2>
          <p>
A Type represents a type of Go.
All types implement the Type interface.
</p>

          
          
          
  


          
            <h3 data-kind="f" id="Default">func <a href="https://github.com/golang/go/blob/master/src/go/types/predicates.go#L298" title="View Source">Default</a>  </h3>
            <p>
Default returns the default "typed" type for an "untyped" type;
it returns the incoming type for all other types. The default type
for untyped nil is untyped nil.
</p>

            
  

          

          
        
          <h2 data-kind="t" id="TypeAndValue">type <a href="https://github.com/golang/go/blob/master/src/go/types/api.go#L254" title="View Source">TypeAndValue</a>  </h2>
          <p>
TypeAndValue reports the type and value (for constants)
of the corresponding expression.
</p>

          
          
          
  


          
            <h3 data-kind="f" id="Eval">func <a href="https://github.com/golang/go/blob/master/src/go/types/eval.go#L37" title="View Source">Eval</a>  </h3>
            <p>
Eval returns the type and, if constant, the value for the
expression expr, evaluated at position pos of package pkg,
which must have been derived from type-checking an AST with
complete position information relative to the provided file
set.
</p>
<p>
If the expression contains function literals, their bodies
are ignored (i.e., the bodies are not type-checked).
</p>
<p>
If pkg == nil, the Universe scope is used and the provided
position pos is ignored. If pkg != nil, and pos is invalid,
the package scope is used. Otherwise, pos must belong to the
package.
</p>
<p>
An error is returned if pos is not within the package or
if the node cannot be evaluated.
</p>
<p>
Note: Eval should not be used instead of running Check to compute
types and values, but in addition to Check. Eval will re-evaluate
its argument each time, and it also does not know about the context
in which an expression is used (e.g., an assignment). Thus, top-
level untyped constants will return an untyped type rather then the
respective context-specific type.
</p>

            
  

          

          
            <h3 data-kind="m" id="TypeAndValue.Addressable">func (TypeAndValue) <a href="https://github.com/golang/go/blob/master/src/go/types/api.go#L299" title="View Source">Addressable</a>  </h3>
            <p>
Addressable reports whether the corresponding expression
is addressable (<a href="https://github.com/golang/go/blob/master/ref/spec#Address_operators">https://github.com/golang/go/blob/master/ref/spec#Address_operators</a>).
</p>

            
  

          
            <h3 data-kind="m" id="TypeAndValue.Assignable">func (TypeAndValue) <a href="https://github.com/golang/go/blob/master/src/go/types/api.go#L305" title="View Source">Assignable</a>  </h3>
            <p>
Assignable reports whether the corresponding expression
is assignable to (provided a value of the right type).
</p>

            
  

          
            <h3 data-kind="m" id="TypeAndValue.HasOk">func (TypeAndValue) <a href="https://github.com/golang/go/blob/master/src/go/types/api.go#L311" title="View Source">HasOk</a>  </h3>
            <p>
HasOk reports whether the corresponding expression may be
used on the lhs of a comma-ok assignment.
</p>

            
  

          
            <h3 data-kind="m" id="TypeAndValue.IsBuiltin">func (TypeAndValue) <a href="https://github.com/golang/go/blob/master/src/go/types/api.go#L276" title="View Source">IsBuiltin</a>  </h3>
            <p>
IsBuiltin reports whether the corresponding expression denotes
a (possibly parenthesized) built-in function.
</p>

            
  

          
            <h3 data-kind="m" id="TypeAndValue.IsNil">func (TypeAndValue) <a href="https://github.com/golang/go/blob/master/src/go/types/api.go#L293" title="View Source">IsNil</a>  </h3>
            <p>
IsNil reports whether the corresponding expression denotes the
predeclared value nil.
</p>

            
  

          
            <h3 data-kind="m" id="TypeAndValue.IsType">func (TypeAndValue) <a href="https://github.com/golang/go/blob/master/src/go/types/api.go#L270" title="View Source">IsType</a>  </h3>
            <p>
IsType reports whether the corresponding expression specifies a type.
</p>

            
  

          
            <h3 data-kind="m" id="TypeAndValue.IsValue">func (TypeAndValue) <a href="https://github.com/golang/go/blob/master/src/go/types/api.go#L283" title="View Source">IsValue</a>  </h3>
            <p>
IsValue reports whether the corresponding expression is a value.
Builtins are not considered values. Constant values have a non-
nil Value.
</p>

            
  

          
            <h3 data-kind="m" id="TypeAndValue.IsVoid">func (TypeAndValue) <a href="https://github.com/golang/go/blob/master/src/go/types/api.go#L265" title="View Source">IsVoid</a>  </h3>
            <p>
IsVoid reports whether the corresponding expression
is a function call without results.
</p>

            
  

          
        
          <h2 data-kind="t" id="TypeName">type <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L158" title="View Source">TypeName</a>  </h2>
          <p>
A TypeName represents a declared type.
</p>

          
          
          
  


          
            <h3 data-kind="f" id="NewTypeName">func <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L162" title="View Source">NewTypeName</a>  </h3>
            
            
  

          

          
            <h3 data-kind="m" id="TypeName.Exported">func (*TypeName) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L96" title="View Source">Exported</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="TypeName.Id">func (*TypeName) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L97" title="View Source">Id</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="TypeName.Name">func (*TypeName) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L94" title="View Source">Name</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="TypeName.Parent">func (*TypeName) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L91" title="View Source">Parent</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="TypeName.Pkg">func (*TypeName) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L93" title="View Source">Pkg</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="TypeName.Pos">func (*TypeName) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L92" title="View Source">Pos</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="TypeName.String">func (*TypeName) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L358" title="View Source">String</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="TypeName.Type">func (*TypeName) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L95" title="View Source">Type</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="Var">type <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L167" title="View Source">Var</a>  </h2>
          <p>
A Variable represents a declared variable (including function parameters and results, and struct fields).
</p>

          
          
          
  


          
            <h3 data-kind="f" id="NewField">func <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L183" title="View Source">NewField</a>  </h3>
            
            
  

          
            <h3 data-kind="f" id="NewParam">func <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L179" title="View Source">NewParam</a>  </h3>
            
            
  

          
            <h3 data-kind="f" id="NewVar">func <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L175" title="View Source">NewVar</a>  </h3>
            
            
  

          

          
            <h3 data-kind="m" id="Var.Anonymous">func (*Var) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L187" title="View Source">Anonymous</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Var.Exported">func (*Var) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L96" title="View Source">Exported</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Var.Id">func (*Var) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L97" title="View Source">Id</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Var.IsField">func (*Var) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L188" title="View Source">IsField</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Var.Name">func (*Var) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L94" title="View Source">Name</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Var.Parent">func (*Var) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L91" title="View Source">Parent</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Var.Pkg">func (*Var) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L93" title="View Source">Pkg</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Var.Pos">func (*Var) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L92" title="View Source">Pos</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Var.String">func (*Var) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L359" title="View Source">String</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="Var.Type">func (*Var) <a href="https://github.com/golang/go/blob/master/src/go/types/object.go#L95" title="View Source">Type</a>  </h3>
            
            
<div class="clearfix" id="x-footer">
  <div class="container">
    <a href="http://studygolang.com/" target="_blank">Go语言中文网</a>
    <span class="text-muted">|</span> <a href="http://golang.org/" target="_blank">Go Language</a>
    <span class="pull-right"><a href="#">Back to top</a></span>
  </div>
</div>
<script src="../assets/jquery-2.0.3.min.js"></script>
<script src="../assets/bootstrap.min.js"></script>
<script src="../assets/site.js"></script>


</div>